﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewerForm.aspx.cs" Inherits="WellDone.ReportViewerForm" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>WellDone Report Manager</title>
    <style>
        body {
            background-color: white;
            font-family: Verdana;
            font-size: 13px;
        }

        .divHeaderTable {
            width: 100%;
            padding-bottom: 5px;
            display: block;
        }

        .divHeaderRow {
            width: 100%;
            display: block;
            height: 105px;
        }

        .divHeaderColumn {
            float: left;
            width: 33%;
            display: block;
        }

        .divTable {
            width: 100%;
            display: block;
            padding-top: 10px;
            padding-bottom: 10px;
            padding-right: 10px;
            padding-left: 10px;
        }

        .divRow {
            width: 99%;
            display: block;
            padding-bottom: 5px;
        }

        .divColumn {
            width: 70%;
            display: block;
        }

        .ddl {
            font-family: Book Antiqua !important;
            font-size: 14px !important;
            height: auto;
            vertical-align: middle !important;
        }

        .input_text {
            border: 1px solid #c0c0c0;
            padding: 4px;
            font-size: 14px;
            color: #000000;
            background-color: #ffffff;
        }

        .myButton {
            -moz-box-shadow: inset 0px 1px 0px 0px #54a3f7;
            -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7;
            box-shadow: inset 0px 1px 0px 0px #54a3f7;
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7));
            background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%);
            background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%);
            background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%);
            background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%);
            background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%);
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0);
            background-color: #007dc1;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
            border-radius: 3px;
            border: 1px solid #124d77;
            display: inline-block;
            cursor: pointer;
            color: #ffffff;
            font-family: Arial;
            font-size: 13px;
            padding: 6px 24px;
            text-decoration: none;
            text-shadow: 0px 1px 0px #154682;
        }

        .myButton:hover {
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #0061a7), color-stop(1, #007dc1));
            background: -moz-linear-gradient(top, #0061a7 5%, #007dc1 100%);
            background: -webkit-linear-gradient(top, #0061a7 5%, #007dc1 100%);
            background: -o-linear-gradient(top, #0061a7 5%, #007dc1 100%);
            background: -ms-linear-gradient(top, #0061a7 5%, #007dc1 100%);
            background: linear-gradient(to bottom, #0061a7 5%, #007dc1 100%);
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0061a7', endColorstr='#007dc1',GradientType=0);
            background-color: #0061a7;
        }

        .myButton:active {
            position: relative;
            top: 1px;
        }
            
    </style>
    
    <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    
    <script type="text/javascript">
        function ShowPreview() {
            $(function () {
                $("#ReportPlaceholder").dialog({
                    width: 1050,
                    height: 500,
                    modal: true
                });
                $(".ui-dialog-titlebar").removeClass('ui-widget-header');
            });
        };

        function ValidateRequired()
        {
            var isValid = true;
            $(".required").each(function () {
                var id = $(this).attr('id').split('-')[0];
                if($("#"+id).val()=="")
                {
                    alert("Please enter value for required parameter");
                    $("#" + id).focus();
                    isValid = false;
                    return isValid;
                }
            });
            return isValid;
        }
    </script>
</head>

<body>
    <form id="form1" runat="server">
        <asp:ToolkitScriptManager runat="server"></asp:ToolkitScriptManager>
        <asp:Panel runat="server" ID="pnlReportGenerate" Visible="false">
            <div id="content" class="divTable">
                <div class="divRow">
                    <div class="divColumn">
                        <div style="font-size: 12px; margin-left: 2px; font-weight: bold;">
                            <asp:Label runat="server" Text="Report" ID="lblRpeort"></asp:Label>
                            <asp:DropDownList ID="ddlReportName" runat="server" AutoPostBack="true" CssClass="ddl" />
                            &nbsp; &nbsp; &nbsp; &nbsp;
                            
                            <asp:Label runat="server" Text="Format" ID="lblReportFormat"></asp:Label>
                            <asp:DropDownList ID="ddlReportFormat" runat="server" CssClass="ddl">
                                <asp:ListItem Text="EXCEL" Value="xls" Selected="True"></asp:ListItem>
                                <asp:ListItem Text="PDF" Value="PDF"></asp:ListItem>            
                            </asp:DropDownList>
                        </div>
                    </div>
                </div>
            </div>
            <div class="divTable">
                <div class="divRow">
                    <table style="border-width:0px;background-color:blue" runat="server" id="tblParameter" visible="false">
                        <tr style="background-color:blue">
                            <td style="text-align:left;color:white;">Parameters</td>
                            <td style="text-align:right;color:red;">* Required</td>
                        </tr>
                        <tr><td colspan="2">
                            <table cellpadding="5" cellspacing="5" style="border:none;background-color: skyblue; width: 450px;" >
                                <tr style="padding:5px;">
                                    <td colspan="2">
                                        <asp:PlaceHolder ID="ParameterPlaceHolder" runat="server"></asp:PlaceHolder>
                                    </td>
                                </tr>
                            </table>
                        </td></tr>
                    </table>
                    
                </div>
            </div>
            <br />
            <div style="font-size: large; font-weight: bold; color: red;">
                <asp:Label runat="server" ID="lblValidateError"></asp:Label>
            </div>
            <div class="divTable">
                <div class="divRow">
                    <asp:Button ID="btnReport" runat="server" Text="Generate Report" OnClientClick="return ValidateRequired();" OnClick="btnReport_Click" CssClass="myButton" />
                    <asp:Button ID="btnPreview" runat="server" Text="Preview Report" OnClientClick="return ValidateRequired();" OnClick="btnPreview_Click" CssClass="myButton" />
                </div>
            </div>
        </asp:Panel>
        <asp:Panel runat="server" ID="pnlErrorMessage" Visible="false">
            <div style="font-size: large; font-weight: bold; color: red; text-align: center; margin-top: 20px;">
                <asp:Label runat="server" ID="lblErrormessage" Text="You are not authorized to view this page"></asp:Label>
            </div>
        </asp:Panel>
        <div id="ReportPlaceholder" runat="server"></div>
    </form>
</body>
</html>